// import type { App } from 'vue';
import { createPinia } from 'pinia';
import { useStoreUser } from './modules/user';
import { useStorePermission } from './modules/permission';
import { useStoreApp } from './modules/app';
import { useStoreCache } from './modules/cacheViews';
import { useStoreCommonEnum } from './modules/commonEnum';
import { useStoreDict } from './modules/dict';
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate';

export { useStoreUser, useStorePermission, useStoreApp, useStoreCache, useStoreCommonEnum,useStoreDict };

export function useStore() {
  return {
    user: useStoreUser(),
    permission: useStorePermission(),
    app: useStoreApp(),
    cacheView: useStoreCache(),
    commonEnum: useStoreCommonEnum(),
    dict: useStoreDict(),
  };
}

// const store = createPinia();
// export function setupStore(app: App<Element>) {
//   app.use(store);
// }
// export { store };

export default createPinia().use(piniaPluginPersistedstate);
